<?php

/**
 * OfficialSite form base class.
 *
 * @method OfficialSite getObject() Returns the current form's model object
 *
 * @package    iEasy
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseOfficialSiteForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'official_site_id' => new sfWidgetFormInputHidden(),
      'title'            => new sfWidgetFormInputText(),
      'link'             => new sfWidgetFormTextarea(),
      'snapshot'         => new sfWidgetFormTextarea(),
      'comment'          => new sfWidgetFormTextarea(),
      'celebrity_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'add_empty' => true)),
      'company_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Company'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'official_site_id' => new sfValidatorChoice(array('choices' => array($this->getObject()->get('official_site_id')), 'empty_value' => $this->getObject()->get('official_site_id'), 'required' => false)),
      'title'            => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'link'             => new sfValidatorString(array('required' => false)),
      'snapshot'         => new sfValidatorString(array('required' => false)),
      'comment'          => new sfValidatorString(array('required' => false)),
      'celebrity_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'required' => false)),
      'company_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Company'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('official_site[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'OfficialSite';
  }

}
